﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MvcPaging;
using System.Web.Mvc;

namespace HANS_WeChat.Base.Model.WeModel
{
    public  class PagedListModel<T>
    {
        public PagedListModel() {
            Page = 1;
            Size = 10;
            QueryParmeter = new ViewDataDictionary();
        }

        /// <summary>
        /// MvcPaging的分页数据
        /// </summary>
        public IPagedList<T> PagedList { get; set; }

        /// <summary>
        /// 查询字符串的参数集
        /// </summary>
        public ViewDataDictionary QueryParmeter { get; set; }
        /// <summary>
        /// 查询关键字
        /// </summary>
        public string Keyword { get; set; }

        /// <summary>
        /// 每页大小
        /// </summary>
        public int Size { get; set; }

        /// <summary>
        /// 当前页数
        /// </summary>
        public int Page { get; set; }

        /// <summary>
        /// 当前页数索引，从0开始，MvcPaging需要
        /// </summary>
        public int PageIndex
        {
            get
            {
                return (Page - 1 < 0) ? 0 : (Page - 1);
            }
        }
    }
}
